<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8"/>
	<title>Testing websockets</title>
</head>
<body>
    <div>
        <input type="submit" value="start" onclick="start()" />
    </div>
    <div id="messages"></div>
    <script type="text/javascript">
		var webSocket = new WebSocket('ws://localhost:8083/appSocket');

        webSocket.onerror = function(event) {
            onError(event)
        };

        webSocket.onopen = function(event) {
            onOpen(event)
        };

        webSocket.onmessage = function(event) {
            onMessage(event)
        };

        function onMessage(event) {
            document.getElementById('messages').innerHTML += '<br />'
                    + event.data;
        }

        function onOpen(event) {
            document.getElementById('messages').innerHTML = 'Connection established';
        }

        function onError(event) {
            alert(event.data);
        }

        function start() {
            webSocket.send('{"url":"Kline","param":{"basicCurrencyId":17,"benchmarkingCurrencyId":9}}');
            return false;
        }
    </script>
</body>
</html>